﻿<!--{inc(header.view.html)}-->

<div class="content" id="content">
	<div class="top-menu-box">
    	<div class="z">
            <span class="z-f"><a href="#">网站设置</a>&nbsp;&gt;</span>
            <span class="z-f"><a href="#">修改字段</a></span>
            <div class="z-f-r"><span class="user-t"><a href="{$site_url}"  target="_blank">网站首页</a></span><span class="user-info"></span><a href="index.php?app=default&act=quit" onClick="return confirm('确认退出管理系统吗？');"   >退出管理</a></div>
        </div>
        <div class="top-menu">
        	<ul>

			<li><a href="index.php?app=module&act=index"  target="mainframe">模块列表</a></li>
			 <li><a href="index.php?app=module&act=filedlist&id={$id}"  target="mainframe">字段列表</a></li>
                                                 <li><a href="index.php?app=module&act=filedadd&id={$id}"  target="mainframe">字段添加</a></li>
                                                				 
                 <li class="current"><a href="#" >修改字段</a></li>                                


			
            </ul>
            <div class="clear"></div>
        </div>
    </div>
    
    <div class="main">
	
	
<form action="?app=module&act=filedpostedit" method="post" >

<table  class="data" >
<tbody>


<tr>
	<td>字段中文名:</td>
	<td><input type="text" maxlength="20"  size="30" name="data[filed][cname]" value="{$data.filed.cname}"></td>
</tr>

<tr>
	<td>提示信息:</td>
	<td><input type="text" maxlength="20"  size="30" name="data[tips]" value="{$data.tips}"></td>
</tr>

<tr>
	<td>前台提示信息:</td>
	<td><input type="text" maxlength="20"  size="30" name="data[form_tips]" value="{$data.form.tips}"></td>
</tr>

 <tr>
	<td width="30%">数据库字段名<!--: <br><span class="gray">注意：如果下面的[用户填写的表单类型]选择的是"单张图片上传"或"多张图片上传"则改名称一定是"upfile,upfile1,upfile2,upfile3,......"</span>--></td>
	<td><input type="text" maxlength="50" size="50" value="{$data.filed.name}" name="data[filed][name]"></td>
</tr>

<tr>
	<td>数据过滤:</td>
	<td>  <select name="data[filter]"  >
    <?php foreach ( $filter_data.s as $_key => $_value ) { ?>
                 <option value="_{$_key}_" <?php if ( '_' . $_key . '_' == $data.form.filter) { ?> selected="selected" <?php } ?> >{$_key}</option>
                 <?php } ?>

        </select>		
		
</td>
</tr>

<tr>
	<td>数据库字段数据类型:</td>
	<td>  <select name="data[filed][type]"  onChange="field_choose(this.options[this.selectedIndex].value)">
	           <?php if ($data.filed.type) { ?>
                <option value="{$data.filed.type}" selected="selected">{$data.filed.type}</option>
				<?php } ?>	
                <option value="varchar">varchar</option>
                <option value="tinyint">tinyint</option>
                <option value="text">text</option>
                <option value="data">data</option>
                <option value="smallint">smallint</option>
                <option value="mediumint">mediumint</option>
                <option value="int">int</option>
                <option value="bigint">bigint</option>
                <option value="float">float</option>
                <option value="double">double</option>
                <option value="decimal">decimal</option>
                <option value="datetime">datetime</option>
                <option value="timestamp">timestamp</option>
                <option value="time">time</option>
                <option value="year">year</option>
                <option value="char">char</option>
                <option value="tinyblob">tinyblob</option>
                <option value="tinytext">tinytext</option>
                <option value="blob">blob</option>
                <option value="mediumblob">mediumblob</option>
                <option value="mediumtext">mediumtext</option>
                <option value="longblob">longblob</option>
                <option value="longtext">longtext</option>
                <option value="enum">enum</option>
                <option value="set">set</option>
                <option value="bool">bool</option>
                <option value="binary">binary</option>
                <option value="varbinary">varbinary</option>
        </select>		
		
</td>
</tr>

<tr>
	<td>数据库字段长度:</td>
	<td><input type="text" maxlength="20"  size="8" name="data[filed][length]" value="{$data.filed.length}"></td>
</tr>

<tr>
	<td>数据库字段是否为null:</td>
	<td>
	<select name="data[filed][isnull]" >
    <option value="NOT NULL" <?php if ($data.filed.isnull == 'NOT NULL') { ?> selected="selected" <?php } ?> >not null</option>
    <option value="" <?php if ($data.filed.isnull == '') { ?> selected="selected"  <?php } ?>  >null</option>
	           
 
    </select>
</td>
</tr>

<tr>
	<td>数据库字段的默认值:</td>
	<td>
	<input  type="text" name="data[filed][defaultv]" size="12" value="{$data.filed.defaultv}" />
</td>
</tr>

<tr>
	<td>用户填写的表单类型:</td>
	<td>  <select name="data[form][type]"  onChange="form_choose(this.options[this.selectedIndex].value)">

<?php foreach((array)$mdivdata as $_key => $_value ) { ?>
          <option value="{$_value.config.type}"  <?php if ($_value.config.type == $data.form.type) { ?>selected <?php } ?> >{$_value.title}</option>
<?php } ?>
 
        </select>

</td>
</tr>



<?php foreach((array)$mdivdata as $_key => $_value ) { ?>
<?php if(!empty($mdivdata)) { ?>

<?php
      if(!isset($_value.config)){$_value.config='';} 
      if(!isset($_value.config.type)){$_value.config.type='';} 
      if(!isset($data.form)){$data.form='';} 	  
      if(!isset($data.form.type)){$data.form.type='';}  
	  if(!isset($_value.title)){$_value.title='';} 
	  
?>
<tr id="field_form_{$_value.config.type}"  <?php  if ($_value.config.type != $data.form.type) { ?>style="display:none;"<?php } ?> > 
      <td >表单[{$_value.title}]属性:</td> 
      <td > 
	<?php foreach((array)$_value.config as $_key1 => $_value1 ) { ?>
    
<?php
      if(!isset($data['form'][$_value.config.type][$_key1])){$data['form'][$_value.config.type][$_key1]='';} 
	  
?>    
    
	<?php if ($_key1 != 'name' && $_key1 != 'type') { ?>
	  {$_key1}=<input type="text"  size="255"  name="data[form][{$_value.config.type}][{$_key1}]" value="<?php if ($data['form'][$_value.config.type][$_key1]) { ?>{$data['form'][$_value.config.type][$_key1]}<?php } else { ?>{$_value1}<?php } ?>" style="width:400px;"><br/>	 
	  <?php } ?> 	  
    <?php } ?> 		  
      </td>
    </tr>
<?php } ?> 
<?php  } ?>
<tr>
	<td>value值调用(sx数据):</td>
	<td>
 <input type="text" name="data[sx_data]" size="60" value="{$data.form.sx_data}" id="keyword_r">
    	                                 <select name="select4" onChange="MM_keyword2(this,'keyword_r')" > 
										 <option  value="">请选择...</option> 
                                          <?php foreach((array)$sxarray as $_key => $_value ) { ?>

 		                                  <option  value="{$_value}" <?php if ( $data.form.sx_data == $_value) { ?>selected <?php } ?> >{$_key}</option> 

										 <?php } ?> 
	                                     </select><br/>开启数字存储<input name="data[sxdatatype]" type="radio" value="0" <?php if ( $data.form.sxdatatype == 0) { ?> checked="checked" <?php } ?> />&nbsp;&nbsp;开启文字存储<input name="data[sxdatatype]" type="radio" value="1" <?php if ( $data.form.sxdatatype == 1) { ?> checked="checked" <?php } ?> /> 	      
    </td>
</tr> 

<tr>
	<td>排序:</td>
	<td><input type="text" maxlength="3"  size="3" name="data[sort]" value="{$data.sort}"></td>
</tr>  
<tr>
	<td>&nbsp;</td>
	<td><input name="tbid" type="hidden" value="{$tbid}" /><input name="id" type="hidden" value="{$id}" /><input name="data[tablev]" type="hidden" value="{$id}" /><input type="submit" value=" 提 交 " class="buton"></td>
</tr>
</tbody></table>
</form>                                 
                                 
<SCRIPT LANGUAGE="JavaScript"> 

<!--
function get_obj(obj){
   return document.getElementById(obj);
}

function MM_keyword2(selObj,str){ //v3.0
  va=selObj.options[selObj.selectedIndex].value
  if (va!='')
  {

		get_obj(str).value=va;

  } 
}

 
function form_choose(t)
{
	
<?php foreach((array)$mdivdata as $_key => $_value ) { ?>

	if(t=='{$_value.config.type}')
	{
		get_obj('field_form_{$_value.config.type}').style.display='';		    
	}else
	{
		get_obj('field_form_{$_value.config.type}').style.display='none';		    
	}	

<?php } ?>

}
form_choose('<?php if ($data.form.type) { ?>{$data.form.type}<?php }else { ?>{$mdivdata.0.config.type}<?php } ?>');


//-->
</SCRIPT>

 
	

        
        <div class="notic"><img  src="{$web_view_dir}style/images/light.gif" align="absmiddle" /> <b>提示: </b> <span ></span></div>
    </div>
</div>
<!--{inc(footer.view.html)}-->